1 NOTES

Prior to running this file, run:

  • _01_swath-fish-update.R
  • _02_swath-inverts-update.R

to update the data for the most recent year. You will also need to have:

  • swath-process-pre-2017-data.R
  • R-functions-ocnms.R

as helper files.

2 DATA YEAR

Set the data year year

rm(list = ls())
data_year = 2024

2.1 some prep info

3 Process raw data

  • Copy the xlxm files into the year folder.
  • Open and save as xlsx files.

3.1 Bring in data and species codes

## [1] "Loading fish"
## [1] "Running fish"
## [1] "Finished fish"
## [1] "Loading inverts & algae"
## [1] "Running inverts & algae"
## [1] "Running pre-2015 file"
## [1] "ACAHUD"
## [1] "ACANAN"
## [1] "ACMMIT"
## [1] "AGAFIM"
## [1] "ALAMAR"
## [1] "ANTELE"
## [1] "ANTXAN"
## [1] "BALNUB"
## [1] "CADLUT"
## [1] "CANORE"
## [1] "CANSPP"
## [1] "CERFOL"
## [1] "CHITON"
## [1] "CLAMSP"
## [1] "COSCOS"
## [1] "CRAARB"
## [1] "CRAGIG"
## [1] "CROPAP"
## [1] "CRYDEC"
## [1] "CRYSIT"
## [1] "CRYSTE"
## [1] "CUCMIN"
## [1] "CYMTRI"
## [1] "DERIMB"
## [1] "DESSPP"
## [1] "DIASAN"
## [1] "DIOASP"
## [1] "DIRALB"
## [1] "DORODH"
## [1] "dPTECAL"
## [1] "EGRMEN"
## [1] "ENTDOF"
## [1] "EPIPRO"
## [1] "EUPQUI"
## [1] "EVATRO"
## [1] "FUSORE"
## [1] "HALKAM"
## [1] "HENLEV"
## [1] "HERCRA"
## [1] "JANFUS"
## [1] "LAMSET"
## [1] "LEPSPP"
## [1] "LIMCOC"
## [1] "LIRDIR"
## [1] "LOPMAN"
## [1] "MACPYR"
## [1] "MEDAEQ"
## [1] "MESFRA"
## [1] "METGIG"
## [1] "METSPP"
## [1] "MIMFOL"
## [1] "MYTCAL"
## [1] "NERLUE"
## [1] "NO_ALG"
## [1] "NUCLAM"
## [1] "NUDIBR"
## [1] "ORTKOE"
## [1] "PAGSPP"
## [1] "PARCAL"
## [1] "PATMIN"
## [1] "PELNOB"
## [1] "PISBRE"
## [1] "PISGIG"
## [1] "PISOCH"
## [1] "PLEGAR"
## [1] "PODSPP"
## [1] "POLSPP"
## [1] "PTECAL"
## [1] "PTETES"
## [1] "PUGGRA"
## [1] "PUGPRO"
## [1] "PYCHEL"
## [1] "SACGRO"
## [1] "SACLAT"
## [1] "SCALLOP"
## [1] "SCYDEC"
## [1] "SOLDAW"
## [1] "SOLSTI"
## [1] "STARREC"
## [1] "STRDRO"
## [1] "STRPUR"
## [1] "STYFOR"
## [1] "STYMON"
## [1] "TEGSPP"
## [1] "TRICAT"
## [1] "UNIDSP"
## [1] "URTCRA"
## [1] "URTLOF"
## [1] "URTPIS"
## [1] "URTSPP"

4 Data import

Currently the species codes are in separate files from the data. Need to change above xlsx files to contain additional columns for the code sheets.

5 Triggers and Settings

I set some common settings here. The settings.rds file ports the same info over to the multivariate rmd. It is brought in and updated here.

5.1 Set a common theme for plots

6 Manipulate fish data prior to plotting.

Raw data are fish counts by size, so there are multiple observations per species per transect. Sum up counts by transect.

7 Some basic information for summing and analyses below

Minimum vis for fish analysis = 2-m

Kelp depths = 5 -m Fish depths = 5, 10 -m Inv depths = 5 -m

Visibility data for 2015 are fake. DI was bad and set at 1.0 m; other sites set at 3.0 m

8 FISH

8.1 Rockfish YOY - coastwide

Mean abundance of YOY rockfish, averaged across all sites.

## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## Joining with `by = join_by(taxa)`

8.2 Adult fish - coastwide

Species mean abundance across sites for depths listed below.

Fish depth = 5, 10

## Joining with `by = join_by(taxa)`

8.3 Adult Fish - site x year x depth

Species mean abundance by site x year x depth

## Joining with `by = join_by(taxa)`

## YOY rockfish abundance - site x year x depth

Species mean abundance by site x year x depth

## Joining with `by = join_by(taxa)`

# ALGAE & INVERT DATA

Summarize kelp and invert data to get count by transect. Raw files has more detailed observations. Data are imported above.

Kelp depth = 5

A bunch more summarizing at different scales. Also output for multivariate analyses.

## `summarise()` has grouped output by 'year', 'site', 'transect', 'species',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'species', 'zone', 'area'.
## You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'species', 'zone'. You can
## override using the `.groups` argument.
## Joining with `by = join_by(site)`

9 ALGAE

9.1 Nereocystis at Tatoosh

Not sure why I started with this, but the figure is Nereocystis stipe counts at Tatoosh Island.

9.2 Summed Nerocycstis and Macrocystis stipes m2: year x site x depth

Essentially total canopy kelp stipe counts at all sites. Bit odd and not used because of difference in Macro and Nero stipes.

## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site'. You can override using the
## `.groups` argument.

9.3 Stipe counts for Nerocystis, Macrocystis, and Pterogophora by site x species x depth

Stipe counts across site and year for each species separatey.

9.4 Stipe counts for Nerocystis, Macrocystis, and Pterogophora by site x species at 5 m depth

Just a subset of the plot above.

9.5 Coastwide Stipe counts for Nerocystis, Macrocystis, and Pterogophora

Mean stipe count across sites for the big three algae

## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.

9.6 Coastwide Stipe counts for Nerocystis, Macrocystis, and Pterogophora at 5 m depth

Same as above but subset out for just 5 m. Mean ignroes 10-m transects.

## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.

10 INVERTEBRATES

Start with some data manipulations to sum up species by transect.

Table is count of Pycnopodia by year.

## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'species', 'zone', 'area', 'taxa'. You can override using the `.groups`
## argument.
## `summarise()` has grouped output by 'year', 'site', 'species', 'zone', 'area'.
## You can override using the `.groups` argument.
## # A tibble: 9 × 2
##    year    no
##   <dbl> <dbl>
## 1  2015     0
## 2  2016     4
## 3  2017     0
## 4  2018     3
## 5  2019     1
## 6  2021     0
## 7  2022     0
## 8  2023     1
## 9  2024     1

10.1 Urchins

10.1.1 Total urchin density - site x year x depth

Total urchins by site by year. total urchins = purple + red + green

## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone', 'area'. You can
## override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area', 'zone'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.

Max total urchin density at Tatoosh

5-m = 4.0503465 m^-2 10-m = 10.0752194 m^-2

10.1.2 Urchin density by species: year x sites x depth

Moslty at Tatoosh. Mostly purple urchins.

## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.

Max total urchin density at Tatoosh

5-m = 3.7336798 m^-2 10-m = 9.5052194 m^-2

10.1.3 Coastwide urchin density by species

Mean density averaged across sites for a year by species.

## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.

Purple urchin density in 2015 = 0.0116667 urchins per m^2 Purple urchin density in 2019 = 1.7637508 urchins per m^2

Increase was 151.1786432 fold.

Purple urchin density in 2015 = 0.8145345 urchins per m^2

Density compared to 2015 was 69.8172403 fold.

10.2 Total seastar density: site x year x depth

Sum of all observed seastars. Not species.

## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area', 'zone'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.

10.2.1 Coastwide seastars by species

## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.

10.2.2 An ugly and useless figure

## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.

11 Output data for multivariate statistics

11.1 Combine kelp, fish, and inverts for capscale analysis

Not yet transformed to wide format in order to retain SD & SE info upon saving out. Transform in the Multiariate analysis rmd.

Output data files to use for multivariate ordinations.

Use these files and not raw files. Kelp and invert data have been converted to density to account for different transect lengths etc.

## # A tibble: 468 × 37
## # Groups:   site, year, area, zone, transect [468]
##     year site     transect area   zone  AUFL  BAIT  CHNU  CITH  COTT  EMBI  GOBI
##    <dbl> <fct>       <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1  2016 Destruc…        1 N        10     0     0     0     0     0     0     0
##  2  2016 Destruc…        2 N        10     0     0     0     0     0     0     0
##  3  2016 Destruc…        3 N        10     0     0     0     0     0     0     0
##  4  2017 Destruc…        1 N         5     0     0     0     0     0    13     0
##  5  2017 Destruc…        4 N         5     0     0     0     0     0     2     0
##  6  2017 Destruc…        1 S         5     0     0     0     0     0     1     0
##  7  2017 Destruc…        2 S         5     0     0     0     0     0     4     0
##  8  2019 Destruc…        1 N         5     0     0     0     0     0     2     0
##  9  2019 Destruc…        2 N         5     0     0     0     0     0     0     0
## 10  2019 Destruc…        3 N         5     0     0     0     0     0     6     0
## # ℹ 458 more rows
## # ℹ 25 more variables: HEXA <dbl>, NO_DATA <dbl>, OPEL <dbl>, PHOL <dbl>,
## #   RIMU <dbl>, RYOY <dbl>, SCMA <dbl>, SEBSPP <dbl>, SEBSPPyoy <dbl>,
## #   SEBYTyoy <dbl>, SECA <dbl>, SECAyoy <dbl>, SEFL <dbl>, SEMA <dbl>,
## #   SEMAyoy <dbl>, SEME <dbl>, SEMY <dbl>, SEMYyoy <dbl>, SENE <dbl>,
## #   SENEyoy <dbl>, SEPI <dbl>, SEPIyoy <dbl>, TOTyoy <dbl>, UNID <dbl>,
## #   SEBYT <dbl>
## # A tibble: 495 × 20
## # Groups:   year, site, transect, zone, area [495]
##     year site     transect area   zone AGAFIM ALAMAR COSCOS CYMTRI DESSPP EGRMEN
##    <dbl> <fct>       <int> <chr> <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
##  1  2015 Neah Bay        1 D         5      0      0  0          0 0           0
##  2  2015 Neah Bay        2 D         5      0      0  0          0 0           0
##  3  2015 Tatoosh…        1 D         5      0      0  0          0 0           0
##  4  2015 Tatoosh…        2 D         5      0      0  0          0 0           0
##  5  2015 Cape Al…        1 D         5      0      0  0          0 0           0
##  6  2015 Cape Al…        2 D         5      0      0  0          0 0           0
##  7  2015 Cape Jo…        1 D         5      0      0  0          0 0           0
##  8  2015 Cape Jo…        2 D         5      0      0  0          0 0           0
##  9  2015 Destruc…        1 D         5      0      0  0.133      0 0           0
## 10  2015 Destruc…        2 D         5      0      0  0.025      0 0.0167      0
## # ℹ 485 more rows
## # ℹ 9 more variables: LAMSET <dbl>, MACPYR <dbl>, NERLUE <dbl>, NO_ALG <dbl>,
## #   PLEGAR <dbl>, PTECAL <dbl>, SACGRO <dbl>, SACLAT <dbl>, dPTECAL <dbl>
## # A tibble: 497 × 33
## # Groups:   year, site, transect, zone, area [497]
##     year site      transect area   zone Pisaster Pycnopodia Stylasterias anemone
##    <dbl> <fct>        <int> <chr> <dbl>    <dbl>      <dbl>        <dbl>   <dbl>
##  1  2015 Neah Bay         1 D         5  0                0            0 0      
##  2  2015 Neah Bay         2 D         5  0                0            0 0      
##  3  2015 Tatoosh …        1 D         5  0                0            0 0.00556
##  4  2015 Tatoosh …        2 D         5  0.00556          0            0 0.0111 
##  5  2015 Cape Ala…        1 D         5  0.00370          0            0 0      
##  6  2015 Cape Ala…        2 D         5  0                0            0 0      
##  7  2015 Cape Joh…        1 D         5  0                0            0 0      
##  8  2015 Cape Joh…        2 D         5  0                0            0 0.00370
##  9  2015 Destruct…        1 D         5  0                0            0 0      
## 10  2015 Destruct…        2 D         5  0.0111           0            0 0.00741
## # ℹ 487 more rows
## # ℹ 24 more variables: barnacle <dbl>, bivalve <dbl>, `blood star` <dbl>,
## #   `brood star` <dbl>, chiton <dbl>, crabs <dbl>, cucumber <dbl>,
## #   `green urchin` <dbl>, hermit_crabs <dbl>, `kelp crab` <dbl>,
## #   `large star` <dbl>, `leather star` <dbl>, `medium star` <dbl>,
## #   mobile_invert <dbl>, nudibranch <dbl>, octopus <dbl>,
## #   `purple urchin` <dbl>, `red urchin` <dbl>, sea_star_YOY <dbl>, …
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## # A tibble: 45 × 5
## # Groups:   Year [9]
##     Year Site                Fish  Kelp Invertebrates
##    <dbl> <fct>              <dbl> <dbl>         <dbl>
##  1  2015 Cape Johnson           2     2             2
##  2  2015 Cape Alava             2     2             2
##  3  2015 Tatoosh Island         2     2             2
##  4  2015 Neah Bay               2     2             2
##  5  2015 Destruction Island    NA     2             2
##  6  2016 Destruction Island     3     7             7
##  7  2016 Cape Johnson          10    13            13
##  8  2016 Cape Alava            12    10            10
##  9  2016 Tatoosh Island         8     9             9
## 10  2016 Neah Bay              10    10            10
## # ℹ 35 more rows

11.2 Combine data

combind fish and kelp in wide format using fish COUNT data. include area info for fish and kelp

## `summarise()` has grouped output by 'site', 'year', 'zone', 'area', 'transect'.
## You can override using the `.groups` argument.
## `summarise()` has grouped output by 'site', 'year', 'zone', 'area'. You can
## override using the `.groups` argument.
## [1] 123  36
## [1] 4656
## `summarise()` has grouped output by 'site', 'year', 'area', 'zone'. You can
## override using the `.groups` argument.
## [1] 160  20
## Joining with `by = join_by(site, year, zone, area)`
## [1] 123  52

12 Quick view of what species to include in kelp ordinations.

For algae, basically only the big three have any abundance to analyze.

12.1 Algae

## `summarise()` has grouped output by 'species'. You can override using the
## `.groups` argument.

12.2 Fish

Note, the y-axes are very different

## `summarise()` has grouped output by 'taxa'. You can override using the
## `.groups` argument.

12.2.1 Notes

for multivariate analysis; cut and paste to that file

fish.spp = c(“OPEL”, “HEXA”, “SECA”, “SCMA” ,“SENE”, “SEME”, ‘EMBI’,‘GOBI’)

yoy.spp = c(“SECAyoy”, “SEPIyoy”, “SEMYyoy”, “SEBYTyoy”,“RYOY”)

13 SOME USEFUL TABLES

## `summarise()` has grouped output by 'species'. You can override using the
## `.groups` argument.
## Joining with `by = join_by(species)`

14 A tibble: 6 × 5

Species Common name size_class Group Total 1 bait bait-sardines-anchovy BAIT 20200 2 Clupeidae herring BAIT 10298 3 4656 4 Sebastes mela-flav Juveniles yellowtail-black Juveniles small SEBYT 4041 5 Sebastes melanops black rockfish large SEME 2102 6 Hexagrammos decagrammus kelp greenling HEXA 811

## Joining with `by = join_by(species)`
## # A tibble: 6 × 3
##   spp                      Density    SD
##   <chr>                      <dbl> <dbl>
## 1 Pterygophora californica   1.09  1.34 
## 2 Macrocystis pyrifera       0.621 2.60 
## 3 Nerocystis leutkeana       0.605 1.34 
## 4 Laminaria setchellii       0.141 0.431
## 5 Saccharina groenlandica    0.124 0.541
## 6 Pleurophycus gardneri      0.112 0.398
## # A tibble: 6 × 4
##   Species                       Taxa              Density    SD
##   <chr>                         <chr>               <dbl> <dbl>
## 1 Balanus nubilis               barnacle            0.824 3.28 
## 2 Strongylocentrotus purpuratus purple urchin       0.786 2.93 
## 3 Nucella lamellosa             shelled gastropod   0.197 1.09 
## 4 Mesocentrotus franciscanus    red urchin          0.140 0.605
## 5 Styela montereyensis          tunicate            0.130 0.183
## 6 Cucumaria miniata             cucumber            0.107 0.156

15 CANOPY KELP FROM DNR

Imports data file from other R file. Plot just kelp canopy. Add to ggarrange below.

## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.

Mean ha for 2004-2013: 700.6700019 ha +/- 43.6630069 s.e.

Total canopy 2014: 337.2999981 ha

Drop from previous decade: 0.4813964 % of previous cover.

Mean ha for 2015-2020:659.7333332 ha +/- 33.9434596 s.e.

Compared to earlier decade: 0.941575 % of previous cover.

Totals 2014 for Total, Nereo, Macro = 337.2999981, 89.6000009, 247.8999973 ha Totals 2020 for Total, Nereo, Macro = 701.8, 383.4, 318.6 ha

Change was 2.0806404, 4.2790178, 1.2851957 fold.

16 COMBINED FIGURES FOR MS

## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.

17 Combined Kelp and Temperature figure

17.1 Mean SST

##  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## Scale for x is already present. Adding another scale for x, which will replace
## the existing scale.

### Kelp

### Kelp and SST combinded figure